/**
 * 
 */
package kr.co.insoft.driver.model;

/**
 * @author IN-SOFT Inc. GoodwillDD(sylee@in-soft.co.kr) Amazon Regions and
 *         RackSpace Regions
 * 
 *         <pre>
 *         Amazon Regions
 * 		{"endpoint":"ec2.sa-east-1.amazonaws.com","regionName":"sa-east-1"},
 * 		{"endpoint":"ec2.us-east-1.amazonaws.com","regionName":"us-east-1"},
 * 		{"endpoint":"ec2.ap-northeast-1.amazonaws.com","regionName":"ap-northeast-1"},
 * 		{"endpoint":"ec2.us-west-2.amazonaws.com","regionName":"us-west-2"},
 * 		{"endpoint":"ec2.us-west-1.amazonaws.com","regionName":"us-west-1"},
 * 		{"endpoint":"ec2.ap-southeast-1.amazonaws.com","regionName":"ap-southeast-1"},
 * 		{"endpoint" :"ec2.ap-southeast-2.amazonaws.com","regionName":"ap-southeast-2"}
 * </pre>
 * 
 *         RackSpace Regions
 * 
 *         <pre>
 * {scope=ZONE, id=IAD, description=IAD, parent=rackspace-cloudservers-us, iso3166Codes=[US-VA]}, 
 * {scope=ZONE, id=DFW, description=DFW, parent=rackspace-cloudservers-us, iso3166Codes=[US-TX]}, 
 * {scope=ZONE, id=SYD, description=SYD, parent=rackspace-cloudservers-us, iso3166Codes=[AU-NSW]}, 
 * {scope=ZONE, id=HKG, description=HKG, parent=rackspace-cloudservers-us, iso3166Codes=[HK]},
 * {scope=ZONE, id=ORD, description=ORD,parent=rackspace-cloudservers-us, iso3166Codes=[US-IL]}
 * </pre>
 */
public enum ZoneAndRegionDescription {
	IAD {
		@Override
		public String getDesc() {
			return "Norther Virginia";
		}

		@Override
		public String getId() {
			return "IAD";
		}
	},
	DFW {
		@Override
		public String getDesc() {
			return "Dallas";
		}

		@Override
		public String getId() {
			// TODO Auto-generated method stub
			return "DFW";
		}
	},
	SYD {
		@Override
		public String getDesc() {
			return "Sydney";
		}

		@Override
		public String getId() {
			return "SYD";
		}
	},
	HKG {
		@Override
		public String getDesc() {
			return "Hong Kong";
		}

		@Override
		public String getId() {
			return "HKG";
		}
	},
	ORD {
		@Override
		public String getDesc() {
			return "Chicago";
		}

		@Override
		public String getId() {
			return "ORD";
		}
	},
	LON {
		@Override
		public String getDesc() {
			return "London";
		}

		@Override
		public String getId() {
			return "LON";
		}
	},
	US_EAST_1 {
		@Override
		public String getDesc() {
			return "Virginia";
		}

		@Override
		public String getId() {
			return "us-east-1";
		}
	},
	US_WEST_1 {
		@Override
		public String getDesc() {
			return "California";
		}

		@Override
		public String getId() {
			return "us-west-1";
		}
	},
	US_WEST_2 {
		@Override
		public String getDesc() {
			return "Oregon";
		}

		@Override
		public String getId() {
			return "us-west-2";
		}
	},
	EU_WEST_1 {
		@Override
		public String getDesc() {
			return "Dublin";
		}

		@Override
		public String getId() {
			return "eu-west-1";
		}
	},
	SA_EAST_1 {
		@Override
		public String getDesc() {
			return "Sao Paulo";
		}

		@Override
		public String getId() {
			return "sa-east-1";
		}
	},
	AP_NORTHEAST_1 {
		@Override
		public String getDesc() {
			return "Tokyo";
		}

		@Override
		public String getId() {
			return "ap-northeast-1";
		}
	},
	AP_SOUTHEAST_1 {
		@Override
		public String getDesc() {
			return "Singapore";
		}

		@Override
		public String getId() {
			return "ap-southeast-1";
		}
	},
	AP_SOUTHEAST_2 {
		@Override
		public String getDesc() {
			return "Australia Region";
		}

		@Override
		public String getId() {
			return "ap-southeast-2";
		}
	};

	public abstract String getDesc();

	public abstract String getId();

	public static String getDescription(String zones) {
		for (ZoneAndRegionDescription zard : ZoneAndRegionDescription.values()) {
			if (zard.getId().equals(zones) || zones.startsWith(zard.getId()))
				return zard.getDesc();
		}
		return zones;
	}
}
